package login;

import javax.swing.ImageIcon;
import javax.swing.JPanel;
import java.awt.GridBagLayout;
import javax.swing.JLabel;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JButton;
import java.awt.Font;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class LoginGame extends JPanel {

	/**
	 * Create the panel.
	 */
	JPanel contentPane;
	public LoginGame(final JPanel contentPane) {
		this.contentPane = contentPane;
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{161, 136, 156, 0};
		gridBagLayout.rowHeights = new int[]{73, 0, 0, 0, 0, 0, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		
		JLabel lblNewLabel = new JLabel("Caro Chess");
		lblNewLabel.setForeground(Color.RED);
		lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 30));
		GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
		gbc_lblNewLabel.fill = GridBagConstraints.VERTICAL;
		gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
		gbc_lblNewLabel.gridx = 1;
		gbc_lblNewLabel.gridy = 0;
		add(lblNewLabel, gbc_lblNewLabel);
		
		JButton btnSinglePlayer = new JButton("Single Player");
		GridBagConstraints gbc_btnSinglePlayer = new GridBagConstraints();
		gbc_btnSinglePlayer.fill = GridBagConstraints.BOTH;
		gbc_btnSinglePlayer.insets = new Insets(0, 0, 5, 5);
		gbc_btnSinglePlayer.gridx = 1;
		gbc_btnSinglePlayer.gridy = 1;
		add(btnSinglePlayer, gbc_btnSinglePlayer);
		
		JButton btnMultiPlayer = new JButton("Multi Player");
		GridBagConstraints gbc_btnMultiPlayer = new GridBagConstraints();
		gbc_btnMultiPlayer.fill = GridBagConstraints.BOTH;
		gbc_btnMultiPlayer.insets = new Insets(0, 0, 5, 5);
		gbc_btnMultiPlayer.gridx = 1;
		gbc_btnMultiPlayer.gridy = 2;
		add(btnMultiPlayer, gbc_btnMultiPlayer);
		
		JButton btnOptions = new JButton("Options");
		btnOptions.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				contentPane.add( new OptionsPanel());
			}
		});
		GridBagConstraints gbc_btnOptions = new GridBagConstraints();
		gbc_btnOptions.fill = GridBagConstraints.BOTH;
		gbc_btnOptions.insets = new Insets(0, 0, 5, 5);
		gbc_btnOptions.gridx = 1;
		gbc_btnOptions.gridy = 3;
		add(btnOptions, gbc_btnOptions);
		
		JButton btnAbout = new JButton("About");
		GridBagConstraints gbc_btnAbout = new GridBagConstraints();
		gbc_btnAbout.fill = GridBagConstraints.BOTH;
		gbc_btnAbout.insets = new Insets(0, 0, 5, 5);
		gbc_btnAbout.gridx = 1;
		gbc_btnAbout.gridy = 4;
		add(btnAbout, gbc_btnAbout);
		
		JButton btnExit = new JButton("Exit");
		GridBagConstraints gbc_btnExit = new GridBagConstraints();
		gbc_btnExit.fill = GridBagConstraints.BOTH;
		gbc_btnExit.insets = new Insets(0, 0, 0, 5);
		gbc_btnExit.gridx = 1;
		gbc_btnExit.gridy = 5;
		add(btnExit, gbc_btnExit);

	}
	ImageIcon icon = new ImageIcon("player1.jpg");
	public void paintComponent(Graphics g){
		Dimension d = getSize(); 
        g.drawImage(icon.getImage(), 0, 0, d.width, d.height, null); 
        setOpaque(false); 
        super.paintComponent(g); 
}
}
